# name : SQL get all unique combination of one variable/column, then if many to many, by _$3 merge
# key : sql.all.unique.comb.one.var
# contributor: Shuguang Sun
# --
proc sql noprint;
  create table ${1:dtout} as
    select distinct a.$3 as $3, b.$3 as _$3
    from ${2:dtin} (keep = ${3:subjid}) as a, $2 (keep = $3) as b
    where not missing(a.$3) and a.$3 < b.$3
    order by a.$3, b.$3;
  quit;
run;